package com.pengheng.common;

import cn.hutool.core.util.HexUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class MyEncoder extends MessageToByteEncoder<String> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, String o, ByteBuf byteBuf) throws Exception {
        byte[] bytes = new byte[1024];
        bytes[0] = (byte) HexUtil.hexToInt("S");
        bytes[1] = (byte) HexUtil.hexToInt("Z");
        byteBuf.writeBytes(bytes);
    }
}
